/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package projet_maths;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author JR
 */
public class Engine {
    List<Carte> historique;
    
    public Engine()
    {
        historique = new LinkedList<>();
    }
    
    public void Add(Carte c)
    {
        historique.add(c);
    }
    
    public float GetPCOfNumAt(int toSeek, int Pos)
    {
        int cntGood = 0;
        int cntCarte = 0;
        for (Carte c : historique)
        {
            if (c.GetNbNum() < Pos)
            {
                cntCarte++;
                if (c.GetNbNum() < Pos && c.GetPosOf(toSeek) != -1 && c.GetPosOf(toSeek) == Pos)
                {
                    cntGood++;
                }
            }
        }
        if (cntCarte != 0)
        {
            return cntGood/cntCarte;
        }
        else
        {
            return 0;
        }
    }
}